<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col  :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="单据日期">
              <j-date placeholder="开始日期" v-model="queryParam.billDateBegin" class="query-group-cust"/>
              <span class="query-group-split-cust"></span>
              <j-date placeholder="截至日期" v-model="queryParam.billDateEnd" class="query-group-cust"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料描述">
              <a-input placeholder="请输入物料描述" v-model="queryParam.materialDesc"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-model-item label="库房">
              <j-search-select-tag placeholder="请输入库房" v-model="queryParam.warehouseId"
                                   dict="mdm_warehouse,warehouse_name,id"/>
            </a-form-model-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
                  <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                    <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                    <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
                  </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      class="j-table-force-nowrap"
      :scroll="{x:true}"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange">

      <template slot="htmlSlot" slot-scope="text">
        <div v-html="text"></div>
      </template>
      <template slot="imgSlot" slot-scope="text">
        <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
        <img v-else :src="getImgView(text)" height="25px" alt=""
             style="max-width:80px;font-size: 12px;font-style: italic;"/>
      </template>
      <template slot="fileSlot" slot-scope="text">
        <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
        <a-button
          v-else
          :ghost="true"
          type="primary"
          icon="download"
          size="small"
          @click="downloadFile(text)">
          下载
        </a-button>
      </template>
    </a-table>
  </a-card>
</template>

<script>

import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import '@/assets/less/TableExpand.less'
import {getAction} from "@/api/manage";

export default {
  name: "MmRptStockInOutStat",
  mixins: [JeecgListMixin],
  components: {},
  data() {
    return {
      description: '出入库统计',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '物料编号',
          align: "center",
          width: 130,
          dataIndex: 'materialNo',
          scopedSlots: {customRender: 'materialNo'}
        },
        {
          title: '物料描述',
          align: "center",
          dataIndex: 'materialDesc',
          scopedSlots: {customRender: 'materialDesc'},
        },
        {
          title: '单位',
          align: "center",
          dataIndex: 'unit_dictText',
        },
        {
          title: '入库数量',
          align: "center",
          dataIndex: 'sumInQty',
        },
        {
          title: '入库金额',
          align: "center",
          dataIndex: 'sumInPrice',
        },
        {
          title: '出库数量',
          align: "center",
          dataIndex: 'sumOutQty',
        },
        {
          title: '出库金额',
          align: "center",
          dataIndex: 'sumOutPrice',
        },
      ],
      url: {
        list: "/mm/stockInOut/rptStockInOutStatList",
      },
    }
  },
  created() {

  },
  computed: {},
  methods: {
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>